home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
games2
/
rotise12.zip
/
AVL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-03
|
2KB
|
87 lines
/* avl.h Definitions for avl routines
Copyright 1988,1989,1990 Zinn Computer Company
by Mark E. Mallett
All Rights Reserved
All rights reserved;
This software may be used at will, provided that all credits
and style be left in place, and that its distribution is not restricted.
Bug fixes and improvements are welcomed, please send these back to
me at mem@zinn.MV.COM
*/
#ifndef H_AVL /* Prevent multiple inclusions */
#define H_AVL
#ifndef NULL
#define NULL 0
#endif /* NULL */
#ifndef AREG1
/* Prioritized register attributes -- adjust these to
something close to what's supported by the particular
compiler being used. */
#define AREG1 register
#define AREG2 register
#define AREG3 register
#define AREG4
#define AREG5
#define AREG6
#define AREG7
#define AREG8
#define DREG1 register
#define DREG2 register
#define DREG3 register
#define DREG4
#define DREG5
#define DREG6
#define DREG7
#define DREG8
#endif /* AREG1 */
/* Structures */
/* Structure of an avl tree node. Note that this node is meant to
be used as a header or component of an application-specific structure,
since there is no key or data information present in the avlnode
structure.
*/
typedef /* A node in an AVL tree */
struct avlnode {
struct avlnode *n_leftP; /* Ptr to left subtree */
struct avlnode *n_rightP; /* Ptr to right subtree */
int n_balance; /* Balance count */
} AVLNODE;
typedef /* The header for an AVL tree */
struct {
/* Tree parameters */
AVLNODE *t_rootP; /* Ptr to root node */
int t_nodeC; /* Number of nodes */
/* Handler functions for the tree */
int (*t_cmpkey)(); /* Compare two keys */
AVLNODE *(*t_mknode)(); /* Node maker */
int (*t_rmnode)(); /* Node destroyer */
} AVLTREE;
/* Routine declarations: */
#if 0 /* These are in proto.h for bb */
/* extern AVLTREE *avlnew(); */
extern AVLNODE *avlfind();
extern void avlwalk();
extern int avlinsert();
extern int avldelete();
#endif
#endif /* H_AVL; */